package com.limanyik.family.security.controller;

import com.limanyik.family.common.entity.server.security.RegisterVo;
import com.limanyik.family.common.utils.FamilyHttpRequest;
import com.limanyik.family.common.utils.FamilyHttpResponse;
import com.limanyik.family.security.service.RegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 注册Controller
 */
@RestController
public class RegisterController {

    @Autowired
    RegisterService registerService;

    @PostMapping("/regis/doRegister")
    public FamilyHttpResponse doRegister(@RequestBody FamilyHttpRequest<RegisterVo> request) {
        return registerService.doRegister(request.getData());
    }

    /**
     * 完成验证码校验
     *
     * @param requestVo
     * @return
     */
    @PostMapping("/regis/doVerifyCode")
    public FamilyHttpResponse doVerifyCode(@RequestBody FamilyHttpRequest<RegisterVo> requestVo) {
        return registerService.doVerifyCode(requestVo.getData());
    }

}
